//
// Created by ultcrt on 2021/5/21.
//

#ifndef DATA_PROCESSOR_DATA_PROCESSOR_H
#define DATA_PROCESSOR_DATA_PROCESSOR_H

#include <vector>
#include "nlohmann/json.hpp"
#include "hardware_alert.h"

#define MAX_BUFFER 200

typedef struct Alert {
    int code;
    int level;
    Color color;
    bool buzzer_on;
    bool vibrator_on;
} Alert;

class DataProcessor {
private:
    std::vector<nlohmann::json> result_buffer;

    std::map<std::string, Alert> alert_spec;

    Alert cur_alert{};

    HardwareAlert hardware_ctrl;

    void generate_alert(nlohmann::json alert_json);

public:
    DataProcessor(char* alert_file);

    nlohmann::json process(const nlohmann::json& redis_jsons);
};


#endif //DATA_PROCESSOR_DATA_PROCESSOR_H
